/******************************************************************************
 cnome: A C++ source "genes" discover. :-)

 See more details at:

   http://www.codeplex.com/cnome

 The original author site is at: http://www.alexandre-barbosa.com/

 Copyright (c) 2008 Alexandre Barbosa.
 Distributed under the MIT License. (See accompanying file LICENSE-MIT.txt 
 or at http://www.codeplex.com/cnome/license)
 ******************************************************************************/

#ifndef SPECIAL_MEMBER_FUNCTIONS_H
#define SPECIAL_MEMBER_FUNCTIONS_H

#include "actions.h"
#include "cnome.h"
#include "directives.h"
#include "tokens.h"

namespace cnome {
template <typename ScannerT>
void
cpp::definition<ScannerT>::special_member_functions(cpp const& self)
    {
        using namespace actions;
        using namespace directive;
        using namespace util;

		conversion_function_id =
			OPERATOR >> conversion_type_id
		;

		conversion_type_id =
			type_specifier_seq >> !conversion_declarator
		;

		conversion_declarator =
			ptr_operator >> !conversion_declarator
		;

		ctor_initializer =
			COLON >> mem_initializer_list
		;

		mem_initializer_list =
			mem_initializer >> mem_initializer_list_helper
		;

		mem_initializer_list_helper =
			( COMMA >> mem_initializer >> mem_initializer_list_helper ) |
			EPSILON
		;

		mem_initializer =
				mem_initializer_id 
			>>	remain_scope_d[
						LEFTPAREN[&enterScopeMth] 
					>>	!expression_list 
					>> RIGHTPAREN ]
		;

		mem_initializer_id =
			( sss_d[ !(COLON_COLON[&scopeIsAbsolut][&enter_scope]) >> !nested_name_specifier >> class_name ] ) |
			IDENTIFIER
		;

        //  End grammar definition
         
		// turn on the debugging info.
        BOOST_SPIRIT_DEBUG_RULE(conversion_function_id);
        BOOST_SPIRIT_DEBUG_RULE(conversion_type_id);
        BOOST_SPIRIT_DEBUG_RULE(type_specifier_seq);
        BOOST_SPIRIT_DEBUG_RULE(conversion_declarator);
        BOOST_SPIRIT_DEBUG_RULE(ptr_operator);
        BOOST_SPIRIT_DEBUG_RULE(ctor_initializer);
        BOOST_SPIRIT_DEBUG_RULE(mem_initializer_list);
        BOOST_SPIRIT_DEBUG_RULE(mem_initializer);
        BOOST_SPIRIT_DEBUG_RULE(mem_initializer_list_helper);
        BOOST_SPIRIT_DEBUG_RULE(mem_initializer_id);
        BOOST_SPIRIT_DEBUG_RULE(expression_list);
        BOOST_SPIRIT_DEBUG_RULE(nested_name_specifier);
        BOOST_SPIRIT_DEBUG_RULE(class_name);

        BOOST_SPIRIT_DEBUG_RULE(OPERATOR);
        BOOST_SPIRIT_DEBUG_RULE(COLON);
        BOOST_SPIRIT_DEBUG_RULE(COMMA);
        BOOST_SPIRIT_DEBUG_RULE(LEFTPAREN);
        BOOST_SPIRIT_DEBUG_RULE(RIGHTPAREN);
        BOOST_SPIRIT_DEBUG_RULE(COLON_COLON);
        BOOST_SPIRIT_DEBUG_RULE(IDENTIFIER);
        BOOST_SPIRIT_DEBUG_RULE(EPSILON);
    }
}  // namespace cnome
#endif // SPECIAL_MEMBER_FUNCTIONS_DEFINITION_H
